home *** CD-ROM | disk | FTP | other *** search
/ Champak 122 / Vol 122.iso / games / sketchbo.swf / scripts / DefineSprite_416 / frame_1 / DoAction.as
Encoding:
Text File  |  2011-01-06  |  2.4 KB  |  114 lines

  1. function checkEmail(e)
  2. {
  3.    function checkChars(s, i, l)
  4.    {
  5.       while(i < l && "_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".indexOf(s.charAt(i)) != -1)
  6.       {
  7.          i = i + 1;
  8.       }
  9.       return i;
  10.    }
  11.    function checkFirstLevelDomainChars(s, i, l)
  12.    {
  13.       while(i < l && "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(s.charAt(i)) != -1)
  14.       {
  15.          i = i + 1;
  16.       }
  17.       return i == l;
  18.    }
  19.    var _loc1_ = undefined;
  20.    var _loc2_ = undefined;
  21.    var _loc3_ = e.length;
  22.    var _loc5_ = false;
  23.    trace(e);
  24.    if((_loc1_ = checkChars(e,0,_loc3_)) == 0)
  25.    {
  26.       return -1;
  27.    }
  28.    _loc2_ = _loc1_;
  29.    while(_loc1_ < _loc3_ && e.charAt(_loc1_) == ".")
  30.    {
  31.       _loc1_ = _loc1_ + 1;
  32.       if((_loc2_ = checkChars(e,_loc1_,_loc3_)) == _loc1_)
  33.       {
  34.          return -2;
  35.       }
  36.       _loc1_ = _loc2_;
  37.    }
  38.    if(e.charAt(_loc1_) != "@")
  39.    {
  40.       return -3;
  41.    }
  42.    while(true)
  43.    {
  44.       _loc1_ = _loc2_ + 1;
  45.       _loc2_ = checkChars(e,_loc1_,_loc3_);
  46.       if(_loc2_ == _loc1_)
  47.       {
  48.          break;
  49.       }
  50.       if(_loc2_ == e.length)
  51.       {
  52.          _loc2_ -= _loc1_;
  53.          if(_loc5_ && _loc2_ >= 2 && checkFirstLevelDomainChars(e,_loc1_,_loc3_))
  54.          {
  55.             return 1;
  56.          }
  57.          return -5;
  58.       }
  59.       _loc5_ = e.charAt(_loc2_) == ".";
  60.       if(!(_loc1_ < _loc3_ && _loc5_))
  61.       {
  62.          return -6;
  63.       }
  64.    }
  65.    return -4;
  66. }
  67. this.swapDepths(16000);
  68. stop();
  69. closeMe = function()
  70. {
  71.    gotoAndStop(1);
  72. };
  73. expandMe = function()
  74. {
  75.    gotoAndStop(2);
  76. };
  77. sendMail = function()
  78. {
  79.    if(checkEmail(user_email) < 0)
  80.    {
  81.       showAlert(2);
  82.       return undefined;
  83.    }
  84.    showAlert(1);
  85.    this.createEmptyMovieClip("empty",10000);
  86.    this.success = "";
  87.    empty.user_email = user_email;
  88.    user_message = "Feedback for Sketchbook Samurai The Game: \n" add user_message;
  89.    empty.user_message = user_message;
  90.    loadVariables("http://www.sketchbooksamurai.com/thegame/feedbackmail.php",empty,"POST");
  91.    empty.onEnterFrame = function()
  92.    {
  93.       if(this.success != "")
  94.       {
  95.          user_email = "";
  96.          user_message = "";
  97.          showAlert(10);
  98.          delete this.onEnterFrame;
  99.       }
  100.       else
  101.       {
  102.          trace("notYet");
  103.       }
  104.    };
  105. };
  106. showAlert = function(page)
  107. {
  108.    if(!page)
  109.    {
  110.       page = 2;
  111.    }
  112.    alert.gotoAndStop(page);
  113. };
  114.